import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/getParameter")
public class GetParameterService extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        通过req中getParameter这个方法就能拿到query string中的键值对内容
        String studentId =  req.getParameter("studentId");
        String classId =  req.getParameter("classId");
//        设置返回的数据的格式


        resp.setContentType("text/html");
        resp.setCharacterEncoding("utf8");
        resp.getWriter().write("学生id: "+studentId+" 班级id "+classId);
    }

}
